<template>
<div style="margin: 20px;">
<el-container>
    <el-header class="func">学生注册</el-header>
    <el-main>
<el-form label-width="80px"  class="form">
  <el-form-item label="学号">
    <el-input type="text" name="sno" id="sno" width="100" v-model="Addfrom.sno"></el-input>
  </el-form-item>
  <el-form-item label="姓名">
    <el-input type="text" name="sname" id="sname" v-model="Addfrom.sname"></el-input>
  </el-form-item>
  <el-form-item label="年龄">
    <el-input type="text" name="sage" id="sage" v-model="Addfrom.sage"></el-input>
  </el-form-item>
  <el-form-item label="性别">
    <el-input type="text" name="ssex" id="ssex" v-model="Addfrom.ssex"></el-input>
  </el-form-item>
  <el-form-item label="年级">
    <el-input type="text" name="sdept" id="sdept" v-model="Addfrom.sdept"></el-input>
  </el-form-item>
  <el-form-item label="学制">
    <el-input type="text" name="sedu_sys" id="sedu_sys" v-model="Addfrom.sedu_sys"></el-input>
  </el-form-item>
  <el-form-item label="民族">
    <el-input type="text" name="snation" id="snation" v-model="Addfrom.snation"></el-input>
  </el-form-item>
  <el-form-item label="生源地">
    <el-input type="text" name="sregion" id="sregion" v-model="Addfrom.sregion"></el-input>
  </el-form-item>
  <el-form-item label="政治面貌">
    <el-input type="text" name="spolitics" id="spolitics" v-model="Addfrom.spolitics"></el-input>
  </el-form-item>
    <el-form-item >
<el-button class="func" type="primary" @click="submit">注册</el-button>
</el-form-item>
</el-form>
</el-main>
</el-container>
</div>
</template>

<script>
import { ElMessage } from "element-plus";
 export default {
  data() {
    return{
      Addfrom :{
         sno : "",
         sname : "",
         sage : "",
         ssex : "",
         sdept : "",
         sedu_sys : "",
         sregion : "",
         spolitics : "",
         snation : "",
         },
     }
  },
  methods:{
    async submit(){
      const {
        data:res
      } = await this.$http.post("/system/apis/student",this.Addfrom);
      console.log(res);
      if(res.code==20000)
      {
        ElMessage.success({
            message: '注册成功',
            type: 'success'
          });
      }else{
        ElMessage.warning({
            message: '注册失败',
            type: 'warning'
          });
      }
    }
  }
}
</script>

<style>
.func {
  text-align: center;
}
.class {
  width: 500px;
}
</style>